
import React from 'react';
import { connect } from 'dva';
import { createForm } from 'rc-form';
import MemberInfo from 'components/MemberInfo';
import { ScaleChdTemplate } from 'components/scaleChd';

const NativeScaleChdPage = (props) => {
  const { dispatch, ...rest } = props;
  if (!props.location.state || props.location.state.type !== 'chd') {
    props.location.state = { type: 'chd', patientid: props.location.query.memberid, step: 1, patientvalue: null };
  }
  // const redirectUrl = `/native/scale_chd_report?s=app&doctorid=${props.location.query.doctorid}&memberid=${props.location.query.memberid}&hid=${props.location.query.hid}&pid=${props.location.query.pid}`;
  const redirectUrl = `/native/scale_chd_report?s=app&doctorid=${props.location.query.doctorid}&memberid=${props.location.query.memberid}`;
  return (
    <div>
      <MemberInfo {...rest.member} />
      <ScaleChdTemplate {...props} member={rest.member} redirectUrl={redirectUrl} />
    </div>
  );
};

export default connect(({ family }) => ({ ...family }))(createForm()(NativeScaleChdPage));
